﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

using Search;
using Security;

namespace TripLOA.GUI
{
    public class DataSourceRepository
    {
        private string querySearch = "";

        public string QuerySearch
        {
            get { return querySearch; }
            set { querySearch = value; }
        }

        public List<Stats.Objects.RegisteredUser> GetLastUsersRegistered
        {
            get
            {        
                return Groupware.UserManager.getLastFiveRegisteredUsers();
            }
        }

        public List<Stats.Objects.TripProperties> GetLastInsertedTrips
        {
            get
            {
                return Groupware.TripManager.getLastTenCreatedTrips();
            }
        }

        public List<FullTextResult> GetSearchResults
        {
            get
            {
                return SearchManager.FullTextSearch(querySearch);
            }
        }

        public List<Profile> GetBuddyList
        {
            get
            {

                MembershipUser UserSecurity = Membership.GetUser();
                TripLoaUser us = TripLoaUserManager.Instance.getUser(UserSecurity.UserName);
                Profile userProfile = us.GetProfile();

                return userProfile.BuddyList;
            }
        }

        public List<Profile> GetBannedList
        {
            get
            {
                MembershipUser UserSecurity = Membership.GetUser();
                TripLoaUser us = TripLoaUserManager.Instance.getUser(UserSecurity.UserName);
                Profile userProfile = us.GetProfile();

                return userProfile.BannedList;
            }
        }
    }
}
